home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / CRS / crs47.d81 / c64hdpro.arc / C64HDOC.ASCII < prev    next >
Text File  |  2009-10-10  |  15KB  |  462 lines

  1.                            HARD DISK DRIVE ON A C-64
  2.           
  3.           
  4.           
  5.           
  6.                                     PREFACE
  7.           
  8.           This is an explanation of one method of connecting a hard 
  9.           disk drive to the Commodore 64 computer using a Western 
  10.           Digital controller card.  Obviously there are many ways in 
  11.           which to approach this task and each will have its merits.  
  12.           Since there may be a lack of compatibility with some 
  13.           existing software this project may be of limited value and 
  14.           each one should give careful consideration to the the pros 
  15.           and cons before investing in the project.  With this 
  16.           disclaimer in mind, ever onward.
  17.           
  18.           The task of connecting a Western Digital hard disk 
  19.           controller to the C64 is rather simple but does require 
  20.           basic soldering and wiring skills.  Remember that it is 
  21.           possible to damage the C64 and/or the controller card with 
  22.           improper wiring.  The cost of this project is very possibly 
  23.           more than trivial so proceed with caution.  One last time, 
  24.           is it worth the risk and effort?  The availability of a good
  25.           reference manual with the pin out of the expansion port as 
  26.           well as a reference for the PC bus will help to understand 
  27.           the following directions.
  28.           
  29.           Before starting with the details an overview of the 
  30.           controller card might be in order.  A Western Digital WX1 
  31.           controller was used in the prototype but the WX2 should work
  32.           as well.  Don't be concerned as to what BIOS ROM is on the 
  33.           card since it will not be used.  There are several different
  34.           versions of the controller cards but all should work.   The 
  35.           controller writes 17 sectors each of 512 bytes on each track
  36.           which contrasts with the 128 byte sectors on the 1541.  
  37.           Dependent upon the version of the controller card the drives
  38.           supported can have up to 8 or 16 heads and a maximum of 1024
  39.           cylinders.  The software support described later assumes a 
  40.           limit of 8 heads.  A limit of 8 heads will allow for the 
  41.           attachment of a drive with a capacity of greater than 30 
  42.           megabytes.  Additionaly 2 drives can be attached to a 
  43.           controller and more than one controller could be installed 
  44.           offering a great amount of storage relative to a 1541 
  45.           diskette.  A 10 megabyte drive could possibly be a good 
  46.           choice since often a used one can be bought at a very 
  47.           reasonable price.  The controller supports 19 commands for 
  48.           reading, writing, formating, diagnostics, and etc.  With the
  49.           exception of the WX1GEN card there is an eight position 
  50.           header which is normally used to select which drive 
  51.           parameters to use out of a table.  The 'hard disk kernal' 
  52.           doesn't use these.  It reads the configuration off sector 
  53.           zero.  The FORMAT program is responsible for writing the 
  54.           information on the first sector.
  55.           
  56.  
  57.  
  58.  
  59.  
  60.           
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                            HARD DISK DRIVE ON A C-64
  68.           
  69.           
  70.                                                                      2
  71.           
  72.           Okay, now what is needed before starting the adventure?  The
  73.           list follows.
  74.           
  75.                A Western Digital WX1 or WX2 controller card.
  76.           
  77.                A hard disk drive compatible with the controller card.
  78.           
  79.                An enclosure with power supply for the hard disk drive.
  80.                
  81.                Cables to connect the controller to the drive.  (1 34 
  82.                conductor and 1 20 conductor)
  83.           
  84.                An edge card with .1" contact centers to plug into the 
  85.                expansion port.  Radio Shack has one new in 1989 
  86.                (276-192) which will work.
  87.           
  88.                One 31/62 pin pc mount edge connector with .1" centers 
  89.                for the controller card.  (A right angle would be 
  90.                nice.)
  91.           
  92.                One 14 pin IC socket.
  93.           
  94.                One 74LS04 IC.
  95.           
  96.                One .01 uf 10 volt bypass capacitor.
  97.           
  98.                Some 30 gauge or so wire wrap or similar wire.
  99.           
  100.                Possibly a separate power supply for the controller 
  101.                card.  It requires +5 and +12 volts.  This can be 
  102.                obtained from the supply used for the drive.  Radio 
  103.                Shack has a supply with +5vdc, -5vdc, and +12vdc which 
  104.                was originally used on a Coleco which works rather 
  105.                well.
  106.           
  107.           
  108.           
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.           
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                            HARD DISK DRIVE ON A C-64
  134.           
  135.           
  136.                                                                      3
  137.           
  138.           The pertinent pin out for the controller card follows:
  139.           
  140.           
  141.                A2   D7 (data bit seven)
  142.                A3   D6 (data bit six)
  143.                A4   D5 (data bit five)
  144.                A5   D4 (data bit four)
  145.                A6   D3 (data bit three)
  146.                A7   D2 (data bit two)
  147.                A8   D1 (data bit one)
  148.                A9   D0 (data bit zero)
  149.                A22  A9 (address line nine)
  150.                A23  A8 (address line eight)
  151.                A24  A7 (address line seven)
  152.                A25  A6 (address line six)
  153.                A26  A5 (address line five)
  154.                A27  A4 (address line four)
  155.                A28  A3 (address line three)
  156.                A29  A2 (address line two)
  157.                A30  A1 (address line one)
  158.                A31  A0 (address line zero)
  159.                B1   GROUND
  160.                B2   RESET  (active high)
  161.                B3   +5VDC
  162.                B9   +12VDC
  163.                B10  GROUND
  164.                B13  -IOW  (I/O WRITE active low)
  165.                B14  -IOR  (I/O READ active low)
  166.                B29  +5VDC
  167.                B31  GROUND
  168.           
  169.           To locate the pins on the controller card place it component
  170.           side up with the fingers facing you.  Pin A1 will be on the 
  171.           far right and A31 will be on the  far left.  B1, B2, etc. 
  172.           are directly behind the A pins on the opposite side of the 
  173.           card.  Most if not all the cards will have A1 marked as 
  174.           such.  The C64 bus needs to be mapped to the contoller which
  175.           requires some of the signals to be inverted.  The 74LS04 IC 
  176.           is used to invert the required signals and to derive the IOR
  177.           and IOW from the C64 R/W line.
  178.           
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.           
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                            HARD DISK DRIVE ON A C-64
  200.           
  201.           
  202.                                                                      4
  203.           
  204.           The pins of interest on the expansion port are:
  205.           
  206.                1    GROUND
  207.                2    +5 volts dc
  208.                3    +5 volts dc
  209.                5    R/-W  (READ if high, WRITE if low)
  210.                7    -I/O1 (I/O BLOCK 1, active low)
  211.                       or
  212.                10   -I/O2 (I/O BLOCK 2, active low)
  213.                     Either pin 7 or 10 is used for selecting the I/O 
  214.                     address of the controller.
  215.                14   D7 (DATA BIT 7)
  216.                15   D6 (DATA BIT 6)
  217.                16   D5 (DATA BIT 5)
  218.                17   D4 (DATA BIT 4)
  219.                18   D3 (DATA BIT 3)
  220.                19   D2 (DATA BIT 2)
  221.                20   D1 (DATA BIT 1)
  222.                21   D0 (DATA BIT 0)
  223.                22   GROUND
  224.                A    GROUND
  225.                R    A7 (ADDRESS line 7)
  226.                S    A6 (ADDRESS line 6)
  227.                T    A5 (ADDRESS line 5)
  228.                U    A4 (ADDRESS line 4)
  229.                V    A3 (ADDRESS line 3)
  230.                W    A2 (ADDRESS line 2)
  231.                X    A1 (ADDRESS line 1)
  232.                Y    A0 (ADDRESS line 0)
  233.                Z    GROUND
  234.           
  235.           
  236.           Looking at the back of the C64 at the expansion slot, pin 1 
  237.           is on the right top, pin 22 is on the top left, pin A is on 
  238.           the bottom right, and pin Z is on the bottom left.  NOTE 
  239.           that all the alphabet isn't used in numbering the bottom 
  240.           pins, refer to a C64 description for the proper pins.
  241.           
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.           
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                            HARD DISK DRIVE ON A C-64
  266.           
  267.           
  268.                                                                      5
  269.           
  270.           Armed with the above information it's time to start putting 
  271.           the adapter together.  First trim the fingers of the edge 
  272.           card down to where it will properly fit into the expansion 
  273.           port 22/44 pin socket.  CAUTION! Make sure it fits properly.
  274.           A short can blow the fuse in the power supply.  The 
  275.           RS-276-192 card mentioned earlier is made to fit a 36/72 pin
  276.           socket.  Next mount the 14 pin IC socket close to the 
  277.           fingers on the card followed by the 31/62 pin controller 
  278.           socket.  As mentioned in the parts list a right angle would 
  279.           be great since it would allow the controller card to be 
  280.           mounted horizontally, but may be difficult to find.  A wire 
  281.           wrap socket could be used and the pins bent to right angles 
  282.           and trimmed properly.  Connect the fingers to the sockets as
  283.           indicated below.
  284.           
  285.                C64      CONTROLLER
  286.           
  287.                  1          B31       GROUND
  288.                 14          A2        D7
  289.                 15          A3        D6
  290.                 16          A4        D5
  291.                 17          A5        D4
  292.                 18          A6        D3
  293.                 19          A7        D2
  294.                 20          A8        D1
  295.                 21          A9        D0
  296.                 22          B1        GROUND
  297.                  A          B10       GROUND
  298.                  R          A24       A7
  299.                  S          A25       A6
  300.                  T          A26       A5
  301.                  U          A27       A4
  302.                  V          A28       A3
  303.                  W          A29       A2
  304.                  X          A30       A1
  305.                  Y          A31       A0
  306.                  Z          B10       GROUND
  307.           
  308.           Make the following connections to the 14 pin IC socket.
  309.           
  310.                IC      C64        CONTROLLER
  311.           
  312.                 1       C                     -RESET
  313.                 2                    B2       RESET
  314.                 3     7 or 10 (see text)      IO1 or IO2
  315.                 4                  A22 & A23  address bits 8 and 9
  316.                 5       5                     READ/-WRITE
  317.                 6                    B14      -IOR
  318.                 7       1                     GROUND
  319.                 8                    B13      -IOW
  320.                 9 connect to IC pin 6        
  321.                10,11,12,13 no connection     
  322.                14     2 & 3                   +5VDC
  323.           
  324.           
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.                            HARD DISK DRIVE ON A C-64
  332.           
  333.           
  334.                                                                      6
  335.           
  336.           The next step is to connect the +5VDC and +12VDC to the 
  337.           socket for the controller card.  This power can be taken 
  338.           from the power supply in the hard disk enclosure or from a 
  339.           separate supply.  Radio Shack has an inexpensive power 
  340.           supply that was made for Coleco which has +5VDC, +12VDC, and
  341.           -5VDC.  Wherever it comes from, wire the +5VDC to controller
  342.           pins B3 and B29, the +12VDC to controller pin B9, and GROUND
  343.           to controller pins B1, B31, and B10.  With the wiring of the
  344.           adapter complete it is time to connect a hard disk to the 
  345.           controller.  Connect the 34 conducter cable to the header 
  346.           labeled J1 on the controller and the first drive to the 20 
  347.           pin header J2.  The second drive connects to header J3 and 
  348.           to a second edge connector on the 34 conducter cable.  These
  349.           cables must be plugged in so that PIN 1 from the controller 
  350.           is connected to PIN 1 of the drive, etc.  Most cables have a
  351.           solid colored side coresponding to the PIN 1 side and some 
  352.           may be keyed such as to only fit the proper way.  The cables
  353.           can have a maximum length of around 10 feet.  The drive 
  354.           connected to J3 will need its address switches or jumpers to
  355.           be set for drive 2 while the drive in J2 will need to have 
  356.           its switches set for drive 1.  Plug the controller card into
  357.           the adapter and the adapter into the C64 expansion port.  
  358.           Apply power to the drive and controller card along with 
  359.           power to the 64.  If all is well so far then the C64 should 
  360.           come up and run.  If not, something is probably either 
  361.           mis-wired or shorted.  Double check all the connections.  
  362.           Remember that a short could blow a fuse either in the C64 or
  363.           in the power supply block.  Since most of the Commodore 
  364.           supplies are not repairable, a blown fuse in the power 
  365.           supply is bad news to say the least.
  366.           
  367.           Once the hardware is up and apparently working it is time to
  368.           start with the software.  Available with this package is the
  369.           'hard disk kernal'.  This kernal has the support for the 
  370.           nineteen commands.  For a better explanation refer to the 
  371.           source for the kernal and read the comments.  There is a 
  372.           control block used to communicate with the controller called
  373.           the Drive Control Block (DCB) which is 6 bytes long.  The 
  374.           format of the DCB is:
  375.           
  376.              Byte 0 - command code.
  377.              Byte 1 - drive number (0 or 1) and head number.
  378.              Byte 2 - Most significant 2 bits of the cylinder address 
  379.                       and the sector number.
  380.              Byte 3 - Least significant 8 bits of the cylinder 
  381.                       address.
  382.              Byte 4 - Number of sectors to read or write, or the 
  383.                       interleave if formating.
  384.              Byte 5 - Step rate for moving the heads (seeking).
  385.           
  386.           The DCB will need to be updated before reading or writing.  
  387.           The 'hard disk kernal' passes this information on to the 
  388.           controller.  Some additional information is appended to the 
  389.           DCB which is used by the 'hard disk kernal' which is 
  390.           
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                            HARD DISK DRIVE ON A C-64
  398.           
  399.           
  400.                                                                      7
  401.           
  402.           documented in the comments of the source for the kernal.  
  403.           The success of a call to the hard disk kernal is indicated 
  404.           by CARRY being clear upon return, and CARRY set for failure.
  405.           Reference the source for the programs for examples of some 
  406.           of the calls.
  407.           
  408.           
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.